﻿<!--
// This source is subject to Microsoft Public License (Ms-PL).
// Please see http://taskcardcreator.codeplex.com for details.
// All other rights reserved.
-->
<UserControl x:Class="TeamFoundationServer2013Services.Tfs2013UserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:converters="clr-namespace:TeamFoundationServer2013Services.Converters"
             xmlns:l="clr-namespace:ReportInterface;assembly=ReportInterface"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
  <UserControl.Resources>
    <converters:BoolToVisibleConverter x:Key="boolToVisibleConverter"/>
    <converters:PaperTextConverter x:Key="paperTextConverter"/>
    <DataTemplate DataType="{x:Type l:IReport}" x:Key="ReportTemplate">
      <StackPanel Orientation="Horizontal">
        <TextBlock Text="{Binding Path=Description}" />
        <TextBlock Foreground="Red" Text="*" ToolTip="Team customized" Visibility="{Binding Path=TeamCustomized, Converter={StaticResource boolToVisibleConverter}}" />
        <Image Source="Resources\Paper.png" Margin="5,0,0,0" ToolTip="{Binding Path=PaperSize, Converter={StaticResource paperTextConverter}}" />
      </StackPanel>
    </DataTemplate>
    <DataTemplate DataType="{x:Type l:IReport}" x:Key="TeamTemplate">
      <StackPanel Orientation="Horizontal">
        <TextBlock Text="{Binding Path=TeamName}" />
      </StackPanel>
    </DataTemplate>
  </UserControl.Resources>
  <Grid Margin="10">
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="2*" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="4*" />
    </Grid.RowDefinitions>

    <DockPanel Margin="5, 5, 0, 5"  Grid.Column="0" LastChildFill="True">
      <TextBlock DockPanel.Dock="Left" FontWeight="Bold">Report Template:</TextBlock>
      <TextBlock HorizontalAlignment="Right" TextTrimming="CharacterEllipsis">
        <Hyperlink NavigateUri="http://taskcardcreator.codeplex.com/wikipage?title=Template%20Overview" RequestNavigate="HyperlinkRequestNavigate">Learn more...</Hyperlink>
      </TextBlock>
    </DockPanel>
    <ListBox Grid.Row="2" Margin="5, 5, 0, 5" ItemsSource="{Binding Reports}" SelectedValue="{Binding SelectedReport}" ItemTemplate="{StaticResource ReportTemplate}" />

    <TextBlock Grid.Row="3" FontWeight="Bold" Margin="5, 5, 0, 5">Team:</TextBlock>
    <ComboBox Grid.Row="4" Margin="5, 5, 0, 5"  ItemsSource="{Binding Teams}" SelectedValue="{Binding SelectedTeam}" ItemTemplate="{StaticResource TeamTemplate}" />

    <TextBlock Grid.Row="5" FontWeight="Bold" Margin="5, 5, 0, 5">Iteration Path:</TextBlock>
    <ComboBox Grid.Row="6" Margin="5, 5, 0, 5" ItemsSource="{Binding Path=SelectedTeam.TeamSettings.IterationPaths}" SelectedValue="{Binding SelectedIterationPath}" />

    <TextBlock Grid.Row="7" FontWeight="Bold" Margin="5, 5, 0, 5" >Work Items:</TextBlock>
    <Grid Grid.Row="8">
      <ListView Margin="5, 5, 0, 5" ItemsSource="{Binding Path=WorkItems}" Name="listView" HorizontalAlignment="Stretch" ScrollViewer.VerticalScrollBarVisibility="Visible">
        <ListView.View>
          <GridView>
            <GridViewColumn Width="50" Header="Id" DisplayMemberBinding="{Binding Id}"  />
            <GridViewColumn Width="280" Header="Title" DisplayMemberBinding="{Binding Title}" />
            <GridViewColumn Width="90" Header="State" DisplayMemberBinding="{Binding State}" />
          </GridView>
        </ListView.View>
      </ListView>
      <StackPanel Margin="5, 5, 0, 5" VerticalAlignment="Center" Name="progress" Visibility="Collapsed">
        <ProgressBar HorizontalAlignment="Center" IsIndeterminate="True" Margin="5" Width="100" Height="20"></ProgressBar>
        <TextBlock HorizontalAlignment="Center">Loading...</TextBlock>
      </StackPanel>
    </Grid>

  </Grid>
</UserControl>
